package pluginMain;

import java.util.HashMap;
import java.util.Set;

public class Effect {
	public static enum EffectType {
		Poison, AntiPoison, 
		Harden, AntiFire,
		ReserveAttact, Stand,
		AntiWithered,
		LifeSteal, Freeze, Buff, Burn, AttackTwice, CriticalMultiply, IgnoreAmmor, Sacrifice, Therapy, Dodge, Withered, 
		SPSkill, SPLight, SPHeavn, SPRemote,
		DefaultDamage, DefaultAmmor, CriticalDamage,
		PermRequest
	}
	
	private String name;
	private EffectType type;
	private HashMap<String, Integer> level;
	//private int maxDamage, minDamage, maxAmmor, minAmmor, maxCritical, minCritical;
	private int maxValue , minValue ;
	public Effect(String name_, EffectType type_, HashMap<String, Integer> level_) {
		name = name_;
		type = type_;
		level = level_;
	}

	public Effect(String name_, EffectType type_) {
		name = name_;
		type = type_;
		level = new HashMap<String, Integer>();
	}

	public String getName() {
		return name;
	}

	public EffectType getEffect() {
		return type;
	}

	public Set<String> getAllFormatLevel() {
		return level.keySet();
	}
	
	public int getLevelByName(String formatedLevel) {
		return level.get(formatedLevel);
	}

	public int addLevel(String formatedLevel, int Level) {
		level.put(formatedLevel, Level);
		return level.size();
	}
	public void setValue(int max, int min){
		maxValue = max;
		minValue = min;
	}
	public int getValue(){
		return (int)(minValue + (Math.random() * (maxValue - minValue)));
	}
	
	@SuppressWarnings("unchecked")
	public Effect clone(){
		return new Effect(name, type, (HashMap<String, Integer>) level.clone());
	}
	
}
